// =============================================================================
// SCSS/SITE/STACKS/ETHOS/_POPOVERS.SCSS
// -----------------------------------------------------------------------------
// Add small overlays of content, like those on the iPad, to any element for
// housing secondary information. More information can be found here:
// http://twitter.github.com/bootstrap/javascript.html#popovers
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Base Styles
//   02. Arrows
// =============================================================================

// Base Styles
// =============================================================================

.popover {
  position: absolute;
  top: 0;
  left: 0;
  z-index: $zindexPopover;
  display: none;
  width: 236px;
  background-color: $popoverBackground;
  border: 1px solid rgba(0, 0, 0, 0.2);
  text-align: center;
  @include translate3d(0, 0, 0);
  @include background-clip(padding-box);
  @include box-shadow(#{0 1px 5px rgba(0, 0, 0, 0.2)});
  @include transition(#{margin 0.3s ease, opacity 0.3s ease});


  //
  // Offset the popover to account for the popover arrow.
  //

  &.top       { margin-top:   0;       }
  &.right     { margin-left:  0;       }
  &.bottom    { margin-top:   0;       }
  &.left      { margin-left:  0;       }
  &.in.top    { margin-top:  -0.825em; }
  &.in.right  { margin-left:  0.825em; }
  &.in.bottom { margin-top:   0.825em; }
  &.in.left   { margin-left: -0.825em; }
}


//
// 1. Reset heading 'margin'.
//

.popover-title {
  margin: 0; // 1
  padding: 0.571em 0.75em;
  @include font-size(1.5);
  font-weight: 400;
  line-height: 1.3;
  background-color: $popoverTitleBackground;
}

.popover-content {
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  padding: 0.563em 0.875em;
  @include font-size(1.3);
  font-weight: 400;
  line-height: 1.5;

  p,
  ul,
  ol {
    margin-bottom: 0;
  }

  ul,
  ol {
    margin-left: 1.286em;
  }
}



// Arrows
// =============================================================================

.popover .arrow,
.popover .arrow:after {
  position: absolute;
  display: inline-block;
  width: 0;
  height: 0;
  border-color: transparent;
  border-style: solid;
}

.popover .arrow:after {
  content: "";
  z-index: -1;
}

.popover {
  &.top .arrow {
    bottom: -$popoverArrowWidth;
    left: 50%;
    margin-left: -$popoverArrowWidth;
    border-width: $popoverArrowWidth $popoverArrowWidth 0;
    border-top-color: $popoverArrowColor;

    &:after {
      border-width: $popoverArrowOuterWidth $popoverArrowOuterWidth 0;
      border-top-color: $popoverArrowOuterColor;
      bottom: -1px;
      left: -$popoverArrowOuterWidth;
    }
  }

  &.right .arrow {
    top: 50%;
    left: -$popoverArrowWidth;
    margin-top: -$popoverArrowWidth;
    border-width: $popoverArrowWidth $popoverArrowWidth $popoverArrowWidth 0;
    border-right-color: $popoverArrowColor;

    &:after {
      border-width: $popoverArrowOuterWidth $popoverArrowOuterWidth $popoverArrowOuterWidth 0;
      border-right-color: $popoverArrowOuterColor;
      bottom: -$popoverArrowOuterWidth;
      left: -1px;
    }
  }

  &.bottom .arrow {
    top: -$popoverArrowWidth;
    left: 50%;
    margin-left: -$popoverArrowWidth;
    border-width: 0 $popoverArrowWidth $popoverArrowWidth;
    border-bottom-color: $popoverTitleBackground;

    &:after {
      border-width: 0 $popoverArrowOuterWidth $popoverArrowOuterWidth;
      border-bottom-color: $popoverArrowOuterColor;
      top: -1px;
      left: -$popoverArrowOuterWidth;
    }
  }

  &.left .arrow {
    top: 50%;
    right: -$popoverArrowWidth;
    margin-top: -$popoverArrowWidth;
    border-width: $popoverArrowWidth 0 $popoverArrowWidth $popoverArrowWidth;
    border-left-color: $popoverArrowColor;
    
    &:after {
      border-width: $popoverArrowOuterWidth 0 $popoverArrowOuterWidth $popoverArrowOuterWidth;
      border-left-color: $popoverArrowOuterColor;
      bottom: -$popoverArrowOuterWidth;
      right: -1px;
    }
  }
}